package com.core.servlet;

import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.core.utility.TypeUtil;
import com.core.utility.Types;

/**
 * Servlet implementation class CoreServlet
 */
public class CoreServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public CoreServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}
	
	public void init(ServletConfig config) throws ServletException 
	{ 
		System.out.println("Initializing core servlet.");
		super.init(config);
		ServletContext ctx = config.getServletContext();
		ctx.setAttribute("propertyTypes", TypeUtil.getPropertyTypes());
		ctx.setAttribute("city", TypeUtil.getCities());
		
		ctx.setAttribute("locality", TypeUtil.getLocalityType());
		ctx.setAttribute("propertyType", TypeUtil.getPropertyTypes());
		ctx.setAttribute("transactionType", TypeUtil.getTransactionType());
		ctx.setAttribute("bedrooms", TypeUtil.getBedrooms());
		ctx.setAttribute("bathrooms", TypeUtil.getBathroom());
		ctx.setAttribute("furnished", TypeUtil.getFurnishedType());
		ctx.setAttribute("constructionAge", TypeUtil.getConstructionType());
		ctx.setAttribute("ownership", TypeUtil.getOwnership());
		ctx.setAttribute("areaMesurement", TypeUtil.getMeasurementType());
		ctx.setAttribute("priceIn", TypeUtil.getPriceType());
		ctx.setAttribute("month", TypeUtil.getMonth());
		ctx.setAttribute("priceRange", TypeUtil.getPriceRange());
		ctx.setAttribute("year", TypeUtil.getYear());
		
		
		
		System.out.println("Initialized core servlet.");
	}

}
